package com.example.concurrentprogramming8016.locksupport;

import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.locks.LockSupport;

/**
 * @author liyanhao
 * @Date 2023-02-08 0:29
 */
public class LockSupportDemo2 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            System.out.println("线程t1开始执行  LockSupport.park()");
            LockSupport.park();
            System.out.println("线程t1执行  LockSupport.park()结束，被唤醒");
        }, "t1");
        t1.start();

        Thread t2 = new Thread(() -> {
            System.out.println("线程t2唤醒t1");
            LockSupport.unpark(t1);
        }, "t2");
        t2.start();

    }
}
